home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / xcontact / parody / key.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.3 KB  |  45 lines

  1. // ------------- key.h
  2.  
  3. #ifndef KEY_H
  4. #define KEY_H
  5.  
  6. #include "parody.h"
  7.  
  8. // ============================
  9. // Key abstract base class
  10. // ============================
  11. class Key : public LinkedListEntry    {
  12.     NodeNbr fileaddr;      // object node address -> by this key
  13.     NodeNbr lowernode;  // lower node of keys > this key
  14.     int classid;          // class id for this key
  15.     int indexno;          // 0=primary key, > 0=secondary key
  16.     int relatedclass;      // id of class related by this key
  17.     Persistent *object; // object being indexed
  18.     virtual Key *Make() = 0;
  19.     friend class Btree;
  20.     friend class TNode;
  21.     friend class Persistent;
  22. protected:
  23.     Key(NodeNbr fa = 0);
  24.     virtual ~Key() { /* null */ }
  25.     virtual int operator> (Key& key) = 0;
  26.     virtual int operator== (Key& key) = 0;
  27.     virtual Key& operator=(Key& key);
  28.     virtual void Write(fstream& bfile) = 0;
  29.     virtual void Read(fstream& bfile) = 0;
  30.     virtual pBool isNullValue() = 0;
  31. public:
  32.     void PrimaryKey();
  33.     void Relate(int cid)  { relatedclass = cid; }
  34.     void FindObject()         { object->FindObject(this); }
  35.     void FirstObject()     { object->FirstObject(this); }
  36.     void LastObject()         { object->LastObject(this); }
  37.     void NextObject()         { object->NextObject(this); }
  38.     void PreviousObject() { object->PreviousObject(this); }
  39. // UMESH 
  40.     void CurrentObject() { object->CurrentObject(this); }
  41. };
  42.  
  43. #endif
  44.  
  45.